package byx.container.annotation.ExtensionTest;

import byx.container.annotation.extension.impl.BaseClassProcessor;
import byx.container.annotation.extension.core.ClassPostProcessorContext;
import byx.container.annotation.extension.core.ClassProcessorContext;
import byx.container.annotation.extension.impl.ClassScanner;
import byx.container.annotation.annotation.Order;

import java.util.Collections;
import java.util.List;

@Order(100)
public class MyClassProcessor2 extends BaseClassProcessor {
    public MyClassProcessor2(ClassScanner classScanner) {
        super(classScanner);
    }

    @Override
    public List<ClassPostProcessorContext> process(ClassProcessorContext ctx) {
        /*return ctx.getClasses().stream()
                .filter(type -> type.isAnnotationPresent(MyAnno2.class))
                .flatMap(type -> getTypeAndMethodContexts(type).stream())
                .collect(Collectors.toList());*/

        Class<?> type = ctx.getType();
        if (type.isAnnotationPresent(MyAnno2.class)) {
            return getTypeAndMethodContexts(type);
        }
        return Collections.emptyList();
    }
}
